import request from '@/utils/request'

/**
 * @description 列表
 * @param data
 * @returns
 */
export const getEmployeeListApi: IGetEmployeeListApi = function (params) {
  return request.get('htscrm/work/employee', { params });
};

/**
 * @description 所有数据
 * @param params
 * @returns
 */
export const getEmployeeTreeApi: IGetEmployeeTreeApi = function(params) {
  return request.get(`htscrm/store/group/tree`, { params })
}

/**
 * @description 详情
 * @param data
 * @returns
 */
export const getEmployeeDetailApi: IGetEmployeeDetailApi = function (id) {
  return request.get(`htscrm/store/group/info/${id}`);
};

/**
 * @description 添加
 * @param data
 * @returns
 */
export const addEmployeeApi: IAddEmployeeApi = function (data) {
  return request.post('htscrm/store/group/add', data);
};

/**
 * @description 编辑
 * @param data
 * @returns
 */
export const updateEmployeeApi: IUpdateEmployeeApi = function (data) {
  return request.post(`htscrm/store/group/edit/${data.id}`, data);
};

/**
 * @description 删除
 * @param data
 * @returns
 */
export const deleteEmployeeApi: IDeleteEmployeeApi = function (id) {
  return request.post(`htscrm/store/group/del/${id}`);
};

/**
 * @description 同步员工
 * @param data
 * @returns
 */
export const syncEmployeeApi: ISyncEmployeeApi = function () {
  return request.post(`htscrm/work/employee/sync`);
};

/**
 * @description 同步部门
 * @param data
 * @returns
 */
export const syncDepartmentApi: ISyncDepartmentApi = function () {
  return request.post(`htscrm/work/department/sync`);
};

/**
 * @description 获取部门
 * @param data
 * @returns
 */
export const getDepartmentApi: IGetDepartmentApi = function () {
  return request.get(`htscrm/work/department`);
};
